"""
营销下的发送短信页面类
"""
from ..base_page import BasePage
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select

class SendMessgeePage(BasePage):
    #数据
    url="/crm/index.php?m=setting&a=sendsms"
    #定位器
    setmodel_locator = (By.LINK_TEXT, "设置")
    send_messgee_locator = (By.LINK_TEXT, "发送短信")
    phonenum_locator = (By.NAME, "phoneNum")
    selectmodel_locator = (By.NAME, "template")
    smscontent_locator = (By.NAME, "smsContent")
    btn_locator = (By.CSS_SELECTOR,"body > div.container > div.row > div:nth-child(2) > form > div > div:nth-child(2) > div:nth-child(3) > p:nth-child(3) > input.btn.btn-primary")
    tips_success_locator=(By.XPATH,"/ html / body / div[5] / div[2]")
    #方法
    def phonenum(self,phone):
        self.send_keys(self.phonenum_locator,phone)
    def selectmodel(self):
        selectmodel=self.find_element(self.selectmodel_locator)
        selectmodel_obj=Select(selectmodel)
        selectmodel_obj.select_by_visible_text("默认模板")
    def smscontent(self,content):
        self.send_keys(self.smscontent_locator,content)
    def btn_save(self):
        self.click(self.btn_locator)
    def setmodel(self):
        self.click(self.setmodel_locator)
    def send_messgee(self):
        return self.find_element(self.send_messgee_locator).text
    def tips_success(self):
        return self.find_element(self.tips_success_locator).text

